<?php
// Define path to application directory
defined('APPLICATION_PATH')
	|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
	
// Define path to core directory
defined('CORE_PATH')
	|| define('CORE_PATH', realpath(dirname(__FILE__) . '/../core'));

// Define path to root directory
defined('ROOT_PATH')
	|| define('ROOT_PATH', realpath(dirname(__FILE__) . '/..'));

// Define application environment
defined('APPLICATION_ENV')
	|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure core/packages/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
	realpath(CORE_PATH . '/packages'),
	get_include_path(),
)));

/** Core_Application */
require_once 'Zend/Application.php';
require_once 'Core/Application.php';

// Create application, bootstrap, and run
$application = new Core_Application(
	APPLICATION_ENV,
	array(
		'path' => ROOT_PATH . '/configs/',
		'fileName' => 'application.ini'
	)
);
$application->bootstrap()
			->run();